package cn.wlinker.driver.bacnet.constant;


import com.serotonin.bacnet4j.type.enumerated.BinaryPV;
import com.serotonin.bacnet4j.type.primitive.Primitive;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 是否活跃枚举类
 *
 * @author gxsjx
 * @version 1.0
 * @date 2022/9/29
 * Copyright © wlinker.cn
 */
@Getter
@AllArgsConstructor
public enum ActiveEnum {
    //不活跃的
    INACTIVE(BinaryPV.inactive,"0"),
    //活跃的
    ACTIVE(BinaryPV.active,"1");

    private final Primitive primitive;

    private final String value;

    public static Primitive getPrimitiveByValue(String value) {
        for (ActiveEnum activeEnum : ActiveEnum.values()) {
            if (activeEnum.getValue().equals(value)) {
                return activeEnum.getPrimitive();
            }
        }
        return null;
    }
}
